package QL;

import java.util.List;
import java.util.ArrayList;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class ButlerGetResourceChangeReasonMapResponse extends BaseQLResponse
{
    /// <summary>
    /// 所有物品的变化原因列表
    /// </summary>
    public List<ButlerResourceChangeReasonItem> ItemReasonList;

    @Override
    public void DeserializeFromJson(JSONObject jsonObj)
    {
        JSONObject t = jsonObj.getJSONObject("error_response");
        if (t != null && !t.isNullObject())
        {
            ErrCode = t.getString("code");
            ErrMsg = t.getString("msg");
        }
        else
        {
            t = jsonObj.getJSONObject("butler_get_resource_change_reason_map_response");
            ItemReasonList = new ArrayList<ButlerResourceChangeReasonItem>();
            JSONArray arrItemReasonList = t.getJSONObject("item_reason_list").getJSONArray("butler_resource_change_reason_item");
            for (int i = 0; i < arrItemReasonList.size(); ++i)
            {
                ButlerResourceChangeReasonItem o = new ButlerResourceChangeReasonItem();
                o.DeserializeFromJson(arrItemReasonList.getJSONObject(i));
                ItemReasonList.add(o);
            }
        }
    }
}
